//
//  AZHomefourthNewCell.swift
//  AzaanSwift
//
//  Created by Azzan on 2018/4/16.
//  Copyright © 2018年 Azzan. All rights reserved.
//

import UIKit

class AZHomefourthNewCell: UICollectionViewCell, UICollectionViewDelegate, UICollectionViewDataSource {

    @IBOutlet weak var layout: UICollectionViewFlowLayout!
    @IBOutlet weak var collectionView: UICollectionView!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.setCollectionView()
    }

    func setCollectionView(){
        layout.minimumLineSpacing = 10
        layout.itemSize = CGSize(width:116, height:176)
        layout.minimumInteritemSpacing = 20
        layout.sectionInset = UIEdgeInsets(top:0, left:10, bottom:0,right:10)
        collectionView.dataSource = self
        collectionView.delegate = self
        
        collectionView.register(HomeThirdCollectionCell.self, forCellWithReuseIdentifier: "HomeThirdCollectionCell")
        collectionView.register(UINib.init(nibName: "HomeThirdCollectionCell", bundle: nil), forCellWithReuseIdentifier: "HomeThirdCollectionCell")
    }
    
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 1
    }
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 10
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HomeThirdCollectionCell", for: indexPath) as! HomeThirdCollectionCell
        let backView = UIView.init(frame: cell.contentView.frame)
        backView.backgroundColor = #colorLiteral(red: 0.6018690467, green: 0.4892594814, blue: 0.6877163649, alpha: 1)
        cell.backgroundView = backView
        return cell
        
        
    }
}
